//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>
package org.jpgolay.wi.realestate;

import java.io.Serializable;
import java.util.Vector;
import org.jpgolay.wi.persistence.SQLList;

public class RealEstateList
        implements Serializable {

    public RealEstateList() {
        category = "indiff\351rente";
        sort = "indiff\351rent";
        type = "indiff\351rent";
        sector = "indiff\351rent";
        availability = "indiff\351rente";
        price = "indiff\351rent";
        web = "indiff\351rent";
        archive = "indiff\351rent";
        garage = "indiff\351rent";
        parking = "indiff\351rent";
        garden = "indiff\351rent";
        pool = "indiff\351rent";
        kitchen = "indiff\351rent";
        standing = "indiff\351rent";
        meuble = "indiff\351rent";
        fiche = "indiff\351rent";
        lot = "indiff\351rent";
        orderBy = "TYPE";
        realEstateId = "";
        dateAu = "";
        dateDu = "";
        reserve = "indiff\351rent";
        option = "indiff\351rent";
        zip = "indiff\351rent";
        reference = "indiff\351rent";
        residence = "indiff\351rent";
        client = 2;
    }

    public RealEstateList(int client) {
        category = "indiff\351rente";
        sort = "indiff\351rent";
        type = "indiff\351rent";
        sector = "indiff\351rent";
        availability = "indiff\351rente";
        price = "indiff\351rent";
        web = "indiff\351rent";
        archive = "indiff\351rent";
        garage = "indiff\351rent";
        parking = "indiff\351rent";
        garden = "indiff\351rent";
        pool = "indiff\351rent";
        kitchen = "indiff\351rent";
        standing = "indiff\351rent";
        meuble = "indiff\351rent";
        fiche = "indiff\351rent";
        lot = "indiff\351rent";
        orderBy = "TYPE";
        realEstateId = "";
        dateAu = "";
        dateDu = "";
        reserve = "indiff\351rent";
        option = "indiff\351rent";
        zip = "indiff\351rent";
        reference = "indiff\351rent";
        residence = "indiff\351rent";
        this.client = client;
    }

    public RealEstateList(int client, String portalName) {
        category = "indiff\351rente";
        sort = "indiff\351rent";
        type = "indiff\351rent";
        sector = "indiff\351rent";
        availability = "indiff\351rente";
        price = "indiff\351rent";
        web = "indiff\351rent";
        archive = "indiff\351rent";
        garage = "indiff\351rent";
        parking = "indiff\351rent";
        garden = "indiff\351rent";
        pool = "indiff\351rent";
        kitchen = "indiff\351rent";
        standing = "indiff\351rent";
        meuble = "indiff\351rent";
        fiche = "indiff\351rent";
        lot = "indiff\351rent";
        orderBy = "TYPE";
        realEstateId = "";
        dateAu = "";
        dateDu = "";
        reserve = "indiff\351rent";
        option = "indiff\351rent";
        zip = "indiff\351rent";
        reference = "indiff\351rent";
        residence = "indiff\351rent";
        this.client = client;
        this.portalName = portalName;
    }

    private void init() {
        if (list == null) {
            list = new SQLList();
        }
    }

    public boolean searchAll() {
        if (client == 2) {
            if (execute("SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, SALE, PHOTOS_VALID FROM REALESTATE ")) {
                buildColumns(2);
                return true;
            } else {
                return false;
            }
        }
        if (client == 1) {
            if (execute("SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, RENT, SALE, PHOTOS_VALID FROM REALESTATE ")) {
                buildColumns(2);
                return true;
            } else {
                return false;
            }
        }
        if (client == 3) {
            if (execute("SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, SALE, PHOTOS_VALID FROM REALESTATE, USER WHERE LASTNAME=")) {
                buildColumns(2);
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

    public boolean searchWap(int requestType) {
        switch (requestType) {
            case 1: // '\001'
                if (execute("SELECT ID, TYPE, COUNTY FROM REALESTATE WHERE CATEGORY='location' AND ARCHIVE='F' AND WEB != 'agence' ORDER BY TYPE")) {
                    buildColumns(4);
                    return true;
                } else {
                    return false;
                }

            case 2: // '\002'
                if (execute("SELECT ID, TYPE, COUNTY FROM REALESTATE WHERE CATEGORY='vente' AND ARCHIVE='F' AND WEB != 'agence' ORDER BY TYPE")) {
                    buildColumns(4);
                    return true;
                } else {
                    return false;
                }

            case 3: // '\003'
                if (execute("SELECT ID, TYPE, COUNTY FROM REALESTATE WHERE CATEGORY='villegiature' AND ARCHIVE='F' AND WEB != 'agence' ORDER BY TYPE")) {
                    buildColumns(4);
                    return true;
                } else {
                    return false;
                }
        }
        return false;
    }

    public boolean searchBy(String realEstateId) {
        return request(realEstateId);
    }

    public boolean searchBy() {
        return request(null);
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setSector(String sector) {
        this.sector = sector;
    }

    public void setAvailability(String availability) {
        this.availability = availability;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public void setWeb(String web) {
        this.web = web;
    }

    public void setStanding(String standing) {
        this.standing = standing;
    }

    public void setPool(String pool) {
        this.pool = pool;
    }

    public void setGarden(String garden) {
        this.garden = garden;
    }

    public void setKitchen(String kitchen) {
        this.kitchen = kitchen;
    }

    public void setParking(String parking) {
        this.parking = parking;
    }

    public void setGarage(String garage) {
        this.garage = garage;
    }

    public void setArchive(String archive) {
        this.archive = archive;
    }

    public void setMeuble(String meuble) {
        this.meuble = meuble;
    }

    public void setFiche(String fiche) {
        this.fiche = fiche;
    }

    public void setLot(String lot) {
        this.lot = lot;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public void setRealEstateId(String realEstateId) {
        this.realEstateId = realEstateId;
    }

    public void setDateAu(String dateAu) {
        this.dateAu = dateAu;
    }

    public void setDateDu(String dateDu) {
        this.dateDu = dateDu;
    }

    public void setReserve(String reserve) {
        this.reserve = reserve;
    }

    public void setOption(String option) {
        this.option = option;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    public void setResidence(String residence) {
        this.residence = residence;
    }

    public Vector getRows() {
        return rows;
    }

    public Vector getColumns() {
        return columns_fr;
    }

    private boolean request(String realEstateId) {
        StringBuffer r = new StringBuffer();
        int choice = 0;
        boolean where = true;
        if (category.equals("location")) {
            if (client == 2) {
                r.append("SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='location' AND AGENCY_ID=" + realEstateId + " ");
            } else if (client == 1) {
                r.append("SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, RENT, FURNISHED, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='location' ");
            } else if (client == 3) {
                r.append("SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE, USER WHERE CATEGORY='location' AND LASTNAME='" + portalName + "' AND REALESTATE.AGENCY_ID = AGENCY.ID ");
            }
            where = false;
        } else if (category.equals("vente")) {
            if (client == 2) {
                r.append("SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, SALE, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='vente' AND AGENCY_ID=" + realEstateId + " ");
            } else if (client == 1) {
                r.append("SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, SALE, FURNISHED, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='vente' ");
            } else if (client == 3) {
                r.append("SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, SALE, PHOTOS_VALID FROM REALESTATE, USER WHERE CATEGORY='vente' AND LASTNAME='" + portalName + "' AND REALESTATE.AGENCY_ID = AGENCY.ID ");
            }
            where = false;
            choice = 1;
        } else if (category.equals("vill\351giature")) {
            if (client == 2) {
                r.append("SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='villegiature' AND AGENCY_ID=" + realEstateId + " ");
            } else if (client == 1) {
                r.append("SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, RENT, FURNISHED, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='villegiature' ");
            } else if (client == 3) {
                r.append("SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE, USER WHERE CATEGORY='villegiature' AND LASTNAME='" + portalName + "' AND REALESTATE.AGENCY_ID = AGENCY.ID ");
            }
            where = false;
        } else {
            if (client == 2) {
                r.append("SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, SALE, PHOTOS_VALID FROM REALESTATE ");
            } else if (client == 1) {
                r.append("SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, RENT, SALE, PHOTOS_VALID FROM REALESTATE ");
            } else if (client == 3) {
                r.append("SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, SALE, PHOTOS_VALID FROM REALESTATE, USER WHERE LASTNAME=" + portalName + "' AND REALESTATE.AGENCY_ID = AGENCY.ID ");
            }
            choice = 2;
        }
        if (!sort.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE SORT='" + sort + "' ");
                where = false;
            } else {
                r.append("AND SORT='" + sort + "' ");
            }
        }
        if (!type.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE TYPE='" + type + "' ");
                where = false;
            } else {
                r.append("AND TYPE='" + type + "' ");
            }
        }
        if (!fiche.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE REALESTATE.ID >= " + fiche + " ");
                where = false;
            } else {
                r.append("AND REALESTATE.ID >= " + fiche + " ");
            }
        }
        if (!lot.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE BATCH='" + lot + "' ");
                where = false;
            } else {
                r.append("AND BATCH='" + lot + "' ");
            }
        }
        if (!meuble.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE FURNISHED='" + meuble + "' ");
                where = false;
            } else {
                r.append("AND FURNISHED='" + meuble + "' ");
            }
        }
        if (!sector.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE SECTOR='" + sector + "' ");
                where = false;
            } else {
                r.append("AND SECTOR='" + sector + "' ");
            }
        }
        if (client == 1) {
            if (!availability.equals("indiff\351rente")) {
                if (where) {
                    r.append("WHERE " + availability + " >= '" + dateDu + "' AND " + availability + " <= '" + dateAu + "' ");
                    where = false;
                } else {
                    r.append("AND " + availability + " >= '" + dateDu + "' AND " + availability + " <= '" + dateAu + "' ");
                }
            }
        } else if (!availability.equals("indiff\351rente")) {
            if (where) {
                r.append("WHERE AVAILABILITY<'" + availability + "' ");
                where = false;
            } else {
                r.append("AND AVAILABILITY<'" + availability + "' ");
            }
        }
        if (!price.equals("indiff\351rent")) {
            if (choice == 1) {
                if (where) {
                    r.append("WHERE SALE" + price + " ");
                    where = false;
                } else {
                    r.append("AND SALE" + price + " ");
                }
            } else if (where) {
                r.append("WHERE RENT" + price + " ");
                where = false;
            } else {
                r.append("AND RENT" + price + " ");
            }
        }
        if (client == 1) {
            if (!web.equals("indiff\351rent")) {
                if (where) {
                    r.append("WHERE WEB='" + web + "' ");
                    where = false;
                } else {
                    r.append("AND WEB='" + web + "' ");
                }
            }
        } else if (client == 2) {
            if (where) {
                r.append("WHERE WEB != 'agence' ");
                where = false;
            } else {
                r.append("AND WEB != 'agence' ");
            }
        } else if (client == 3) {
            if (where) {
                r.append("WHERE WEB = 'portail' ");
                where = false;
            } else {
                r.append("AND WEB = 'portail' ");
            }
        }
        if (!archive.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE ARCHIVE='" + archive + "' ");
                where = false;
            } else {
                r.append("AND ARCHIVE='" + archive + "' ");
            }
        }
        if (!parking.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE PARKING != 'non' ");
                where = false;
            } else {
                r.append("AND PARKING != 'non' ");
            }
        }
        if (!garage.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE GARAGE != 'non' ");
                where = false;
            } else {
                r.append("AND GARAGE != 'non' ");
            }
        }
        if (!kitchen.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE KITCHEN='" + kitchen + "' ");
                where = false;
            } else {
                r.append("AND KITCHEN='" + kitchen + "' ");
            }
        }
        if (!garden.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE GARDEN='" + garden + "' ");
                where = false;
            } else {
                r.append("AND GARDEN='" + garden + "' ");
            }
        }
        if (!pool.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE POOL='" + pool + "' ");
                where = false;
            } else {
                r.append("AND POOL='" + pool + "' ");
            }
        }
        if (!standing.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE STANDING='" + standing + "' ");
                where = false;
            } else {
                r.append("AND STANDING='" + standing + "' ");
            }
        }
        if (!zip.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE ZIP LIKE '" + zip + "%' ");
                where = false;
            } else {
                r.append("AND ZIP LIKE '" + zip + "%' ");
            }
        }
        if (!option.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE ONLYOPTION='" + option + "' ");
                where = false;
            } else {
                r.append("AND ONLYOPTION='" + option + "' ");
            }
        }
        if (!reserve.equals("indiff\351rent")) {
            if (where) {
                if (reserve.equals("oui")) {
                    r.append("WHERE RESERVE IS NOT NULL ");
                } else {
                    r.append("WHERE RESERVE IS NULL ");
                }
                where = false;
            } else if (reserve.equals("oui")) {
                r.append("AND RESERVE IS NOT NULL ");
            } else {
                r.append("AND RESERVE IS NULL ");
            }
        }
        if (!reference.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE REF_INTERNAL LIKE '" + reference + "%' ");
                where = false;
            } else {
                r.append("AND REF_INTERNAL LIKE '" + reference + "%' ");
            }
        }
        if (!residence.equals("indiff\351rent")) {
            if (where) {
                r.append("WHERE RESIDANCE LIKE '" + residence + "%' ");
                where = false;
            } else {
                r.append("AND RESIDANCE LIKE '" + residence + "%' ");
            }
        }
        if (where) {
            r.append("WHERE AGENCY_ID=" + realEstateId + " ");
            where = false;
        } else {
            r.append("AND AGENCY_ID=" + realEstateId + " ");
        }
        if (orderBy.equals("PRICE")) {
            if (choice == 1) {
                r.append("ORDER BY SALE");
            } else {
                r.append("ORDER BY RENT");
            }
        } else {
            r.append("ORDER BY " + orderBy);
        }
        if (execute(r.toString())) {
            buildColumns(choice);
            return true;
        } else {
            return false;
        }
    }

    public boolean execute(String requete) {
        init();
        if (list.search(requete)) {
            rows = list.getRows();
            columns = list.getColumns();
            return true;
        } else {
            return false;
        }
    }

    private void buildColumns(int i) {
        switch (client) {
            default:
                break;

            case 2: // '\002'
                columns_fr = new Vector();
                columns_fr.addElement("REFERENCE");
                columns_fr.addElement(" ");
                columns_fr.addElement("TYPE");
                columns_fr.addElement("SECTEUR");
                columns_fr.addElement("QUARTIER");
                columns_fr.addElement("COMMUNE");
                switch (i) {
                    case 0: // '\0'
                        columns_fr.addElement("LOYER");
                        break;

                    case 1: // '\001'
                        columns_fr.addElement("PRIX DE VENTE");
                        break;

                    case 2: // '\002'
                        columns_fr.addElement("LOYER");
                        columns_fr.addElement("PRIX DE VENTE");
                        break;
                }
                columns_fr.addElement("PHOTO");
                break;

            case 3: // '\003'
                columns_fr = new Vector();
                columns_fr.addElement("REFERENCE");
                columns_fr.addElement(" ");
                columns_fr.addElement("TYPE");
                columns_fr.addElement("SECTEUR");
                columns_fr.addElement("QUARTIER");
                columns_fr.addElement("COMMUNE");
                switch (i) {
                    case 0: // '\0'
                        columns_fr.addElement("LOYER");
                        break;

                    case 1: // '\001'
                        columns_fr.addElement("PRIX DE VENTE");
                        break;

                    case 2: // '\002'
                        columns_fr.addElement("LOYER");
                        columns_fr.addElement("PRIX DE VENTE");
                        break;
                }
                columns_fr.addElement("PHOTO");
                break;

            case 1: // '\001'
                columns_fr = new Vector();
                columns_fr.addElement("FICHE");
                columns_fr.addElement("REF");
                columns_fr.addElement("LOT");
                columns_fr.addElement("GENRE");
                columns_fr.addElement("TYPE");
                columns_fr.addElement("SECT.");
                columns_fr.addElement("QUARTIER");
                columns_fr.addElement("RESIDENCE");
                columns_fr.addElement("D. SOUHAITE");
                columns_fr.addElement("D. ACCEPTE");
                columns_fr.addElement("OPT.");
                columns_fr.addElement("RESERVE");
                switch (i) {
                    case 0: // '\0'
                        columns_fr.addElement("LOYER");
                        columns_fr.addElement("MBL");
                        break;

                    case 1: // '\001'
                        columns_fr.addElement("PRIX");
                        columns_fr.addElement("MBL");
                        break;

                    case 2: // '\002'
                        columns_fr.addElement("LOYER");
                        columns_fr.addElement("PRIX");
                        break;
                }
                columns_fr.addElement("P.");
                break;

            case 4: // '\004'
                columns_fr = new Vector();
                columns_fr.addElement("REF");
                columns_fr.addElement("TYPE");
                columns_fr.addElement("COMMUNE");
                break;
        }
    }
    private Vector rows;
    private Vector columns;
    private Vector columns_fr;
    private SQLList list;
    private String category;
    private String sort;
    private String type;
    private String sector;
    private String availability;
    private String price;
    private String web;
    private String archive;
    private String garage;
    private String parking;
    private String garden;
    private String pool;
    private String kitchen;
    private String standing;
    private String meuble;
    private String fiche;
    private String lot;
    private String orderBy;
    private String realEstateId;
    private String dateAu;
    private String dateDu;
    private String reserve;
    private String option;
    private String zip;
    private String reference;
    private String residence;
    public static final int APP = 1;
    public static final int WEB = 2;
    public static final int WEB_PORTAL = 3;
    public static final int WAP = 4;
    public static final int LOCATION = 1;
    public static final int VENTE = 2;
    public static final int VACATION = 3;
    private int client;
    private String portalName;
    private final String ALL = "SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, SALE, PHOTOS_VALID FROM REALESTATE ";
    private final String RENT = "SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='location' AND AGENCY_ID=";
    private final String VACA = "SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='villegiature' AND AGENCY_ID=";
    private final String SALE = "SELECT ID, AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, SALE, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='vente' AND AGENCY_ID=";
    private final String ALL_PORTAL = "SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, SALE, PHOTOS_VALID FROM REALESTATE, USER WHERE LASTNAME=";
    private final String RENT_PORTAL = "SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE, USER WHERE CATEGORY='location' AND LASTNAME='";
    private final String VACA_PORTAL = "SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, RENT, PHOTOS_VALID FROM REALESTATE, USER WHERE CATEGORY='villegiature' AND LASTNAME='";
    private final String SALE_PORTAL = "SELECT REALESTATE.ID, REALESTATE.AGENCY_ID, TYPE, SECTOR, AREA, COUNTY, SALE, PHOTOS_VALID FROM REALESTATE, USER WHERE CATEGORY='vente' AND LASTNAME='";
    private final String ALL_APP = "SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, RENT, SALE, PHOTOS_VALID FROM REALESTATE ";
    private final String RENT_APP = "SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, RENT, FURNISHED, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='location' ";
    private final String VACA_APP = "SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, RENT, FURNISHED, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='villegiature' ";
    private final String SALE_APP = "SELECT ID, REF_INTERNAL, BATCH, SORT, TYPE, SECTOR, AREA, RESIDANCE, DEPARTURE_CUSTOMER, DEPARTURE, ONLYOPTION, RESERVE, SALE, FURNISHED, PHOTOS_VALID FROM REALESTATE WHERE CATEGORY='vente' ";
    private final String RENT_WAP = "SELECT ID, TYPE, COUNTY FROM REALESTATE WHERE CATEGORY='location' AND ARCHIVE='F' AND WEB != 'agence' ORDER BY TYPE";
    private final String VACA_WAP = "SELECT ID, TYPE, COUNTY FROM REALESTATE WHERE CATEGORY='villegiature' AND ARCHIVE='F' AND WEB != 'agence' ORDER BY TYPE";
    private final String SALE_WAP = "SELECT ID, TYPE, COUNTY FROM REALESTATE WHERE CATEGORY='vente' AND ARCHIVE='F' AND WEB != 'agence' ORDER BY TYPE";
}
